package com.olympus.hermes.product.bean.dto.product;

import com.olympus.hermes.common.bean.AbstractBeanConvert;
import com.olympus.hermes.product.domain.Product;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.Instant;

/**
 * @author Mickey
 * @since 2021/2/5
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class OutputProductDTO extends AbstractBeanConvert<OutputProductDTO, Product> {

    private Long id;

    private Instant createdAt;

    private String name;

    @Override
    protected Product doForward(OutputProductDTO outputProductDTO) {
        return null;
    }

    @Override
    protected OutputProductDTO doBackward(Product product) {
        this.setCreatedAt(product.getCreatedAt());
        this.setName(product.getName());
        this.setId(product.getId());
        return this;
    }
}
